//
//  DetailGoodsSpecificationCell.swift
//  ABSallRec
//
//  Created by 我演示 on 2019/11/7.
//  Copyright © 2019 Jerry-Fu. All rights reserved.
//



import UIKit
import SnapKit

/// 选择规格属性

class DetailGoodsSpecificationCell: UITableViewCell {

    /// 将来需要在controller中调用的信息展示接口，需要添加@objc
    @objc  fileprivate lazy  var nameLabel : UILabel = {
        let label = UILabel.init("规格", textFont: 13, textAlignment: .left, textColor: UIColor.initWithHex(hexString: "#666666"))
        return label
    }()
    
    @objc fileprivate lazy var selectSpecLabel: UILabel = {
        let label = UILabel.init("选择尺码", textFont: 13, textAlignment: .left, textColor: UIColor.initWithHex(hexString: "#232321"))
        return label
    }()
    
    //3: 确定image信息
    fileprivate lazy var rightArrowImage : UIImageView = {
        let arrowImage = UIImageView.init(image: UIImage.init(named: "tabBar_publish_icon"));
        return arrowImage
    }()
    
    /// 添加和布局
    override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
        super.init(style: style, reuseIdentifier: reuseIdentifier)
        makeUpUI()
        makeUpSubviews()
    }
    
    required init?(coder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
}

extension DetailGoodsSpecificationCell {
    fileprivate func makeUpUI() {
        addSubview(nameLabel)
        
        /// 添加选择规格的按键
        addSubview(selectSpecLabel)
        
        /// 添加右侧的image信息
        addSubview(rightArrowImage)
    }
    
    fileprivate func makeUpSubviews() {
        //1:尺寸信息
        nameLabel.snp.makeConstraints { (make) in
            make.top.bottom.equalTo(self).offset(0)
            make.left.equalTo(self).offset(15)
            make.width.equalTo(30)
        }
        
        //2: 选择尺码的信息
        selectSpecLabel.snp.makeConstraints { (make) in
            make.left.equalTo(nameLabel.snp_right).offset(20)
             make.top.bottom.equalTo(self).offset(0)
            make.right.equalTo(self).offset(-50)
        }
        
        //3: 添加右侧的imageView
        rightArrowImage .snp.makeConstraints { (make) in
            make.right.equalTo(self).offset(-12)
            make.centerY.equalTo(self.snp_centerY).offset(0)
            make.width.equalTo(7)
            make.height.equalTo(13)
        }
        
    }
}
